@charset "utf-8";

@import '../variable';

/**
 *
 * @Button.css
 * @author zhangxinxu
 * @create 15-06-12
 * @edit   17-06-13
           17-11-07 use png+spin for loading
 */

.ui-button {
	display: inline-block;
	line-height: 20px;
	font-size: 14px;
	text-align: center;
	color: $dark;
	border: 1px solid $borderNormal;
	border-radius: $borderRadius;
	padding: 9px 15px;
	min-width: 50px;
	background-color: $white;
	background-repeat: no-repeat;
	background-position: center;
	text-decoration: none;
	-webkit-transition: border-color .15s, background-color .15s, opacity .15s;
	transition: border-color .15s, background-color .15s, opacity .15s;
	cursor: pointer;
	overflow: visible;
}
.ui-button.error {
	border-color: $red!important;
}
div.ui-button {
	display: block;
}
button,
[type="button"],
[type="submit"] {
	outline: 0;
}
input.ui-button,
button.ui-button {
	height: 20px;
	-ms-box-sizing: content-box;
	box-sizing: content-box;
}
.ui-button:hover {
	color: $dark;
	border-color: $borderHover;
	text-decoration: none;
}

.ui-button-clip {
	width: 0; height: 0;
	font-size: 0;
	position: absolute;
	clip: rect(0 0 0 0);
}
.ui-button-clip.ui-outline + label.ui-button {
	outline: 1px dotted $borderFocus;
	outline: 5px auto -webkit-focus-ring-color;
}

.ui-button:not(.disabled):active,
.ui-button:not(.loading):active {
	background-color: $light;
}

.ui-button.disabled:hover,
.ui-button.loading,
.ui-button.loading:hover {
	color: $dark;
	background-color: $white;
	border-color: $borderNormal;
	cursor: default;
}

.ui-button-primary,
.ui-button-primary.disabled:hover,
.ui-button-primary.loading,
.ui-button-primary.loading:hover {
	border: 1px solid $backgroundBlue;
	background-color: $backgroundBlue;
	color: $white;
}
.ui-button-primary:hover {
	background-color: $backgroundBlueHover;
	border-color: $backgroundBlueHover;
	color: $white;
}
.ui-button-primary:not(.disabled):active,
.ui-button-primary:not(.loading):active {
	background-color: $backgroundBlueActive;
	border-color: $backgroundBlueActive;
}

.ui-button-success,
.ui-button-success.disabled,
.ui-button-success.disabled:hover,
.ui-button-success.loading,
.ui-button-success.loading:hover {
	border: 1px solid $backgroundGreen;
	background-color: $backgroundGreen;
	color: $white;
}
.ui-button-success:hover {
	background-color: $backgroundGreenHover;
	border-color: $backgroundGreenHover;
	color: $white;
}

.ui-button-success:not(.disabled):active,
.ui-button-success:not(.loading):active {
	background-color: $backgroundGreenActive;
	border-color: $backgroundGreenActive;
}

.ui-button-warning,
.ui-button-warning.disabled,
.ui-button-warning.disabled:hover,
.ui-button-warning.loading,
.ui-button-warning.loading:hover {
	border: 1px solid $backgroundRed;
	background-color: $backgroundRed;
	color: $white;
}
.ui-button-warning:hover,
input.ui-button-warning:focus,
button.ui-button-warning:focus {
	background-color: $backgroundRedHover;
	border-color: $backgroundRedHover;
	color: $white;
}
.ui-button-warning:not(.disabled):active,
.ui-button-warning:not(.loading):active {
	background-color: $backgroundRedActive;
	border-color: $backgroundRedActive;
}

.ui-button.loading {
	cursor: default;
	-ms-pointer-events: none;
	pointer-events: none;
	color: transparent!important;
	position: relative;
	background-repeat: no-repeat;
	background-position: center;
}

.ui-button.loading:before {
	content: '';
	position: absolute;
	width: 20px; height: 20px;
	left: 0; top: 0; right: 0; bottom: 0;
	margin: auto;
	background: no-repeat center;
}
.ui-button.loading:before,
input.ui-button.loading {
	background-image: url(#{$urlImage}/Button/loading.gif);
}

.ui-button-primary.loading:before,
input.ui-button-primary.loading {
	background-image: url(#{$urlImage}/Button/loading-primary.gif);
}
.ui-button-success.loading:before,
input.ui-button-success.loading {
	background-image: url(#{$urlImage}/Button/loading-success.gif);
}
.ui-button-warning.loading:before,
input.ui-button-warning.loading {
	background-image: url(#{$urlImage}/Button/loading-warning.gif);
}

/* IE10+ png loading */
.ui-button.loading::before {
	background: url(#{$urlImage}/Button/loading-blue.png), linear-gradient(transparent, transparent);
	background-size: 100%;
	-webkit-animation: spin 0.8s linear infinite;
	animation: spin 800ms linear infinite;
}
.ui-button-primary.loading::before,
.ui-button-success.loading::before,
.ui-button-warning.loading::before {
	background: url(#{$urlImage}/Button/loading-white.png), linear-gradient(transparent, transparent);
	background-size: 100%;
}

/* IE8 loading文字隐藏控制-背景色覆盖 */
@media \0screen\,screen\9 {
	.ui-button.loading:before {
		width: auto; height: auto;
		background-color: inherit;
	}
}
